

def douyin_res_deal(res_json:dict,query_time:int = current_timestamp,time_diffence:int = 5*60,video_dir:str = 'video_dir'):
    download_url_list=[]
    if isinstance(res_json,dict):
        for key,value in res_json.items():
            if key == 'aweme_list':
                # item为所有查询到的作品信息dict
                for item in value:
                    video_creat_time = item['create_time']
                    # 时间差判断
                    if query_time - video_creat_time < time_diffence:
                        files_and_dirs=os.listdir(video_dir)
                        files = [file for file in files_and_dirs if os.path.isfile(os.path.join(video_dir, file))]

                        for file in files:
                            filename=os.path.splitext(file)[0]
                        # 判断文件夹内是否已经下载了该视频判断,如果已经存在跳过处理该条视频信息
                            if video_creat_time in filename:
                                continue
                            else:
                                # 视频标题包含了标签内容
                                video_title=item['desc']
                                # 视频链接地址,是个列表有多个url，要找能播放的url，包含play
                                video_url_list=item['video']['play_addr']['url_list']
                                for video_url in video_url_list:
                                    if 'play' in video_url:
                                        video_download_url=video_url
                                        download_url_list.append(video_download_url)
                                        break

            else:
                print('已经查到最后一条符合的作品信息，获取完成')
                # 跳出作品信息循环
                break

except Exception as e:
    print(e)

return download_url_list